/obj/item/weapon/reagent_containers/lipstick
	name = "red lipstick"
	desc = "A generic brand of lipstick."
	icon = 'icons/obj/items.dmi'
	icon_state = "lipstick"
	amount_per_transfer_from_this = 30
	possible_transfer_amounts = null	//list(5, 10, 15)
	volume = 30
	flags = FPRINT | TABLEPASS | OPENCONTAINER
	w_class = 1
	var/colour = "red"
	var/open = 0

/obj/item/weapon/reagent_containers/lipstick/purple
	name = "purple lipstick"
	colour = "purple"

/obj/item/weapon/reagent_containers/lipstick/jade
	name = "jade lipstick"
	colour = "jade"

/obj/item/weapon/reagent_containers/lipstick/black
	name = "black lipstick"
	colour = "black"


/obj/item/weapon/reagent_containers/lipstick/random
	name = "lipstick"

/obj/item/weapon/reagent_containers/lipstick/random/New()
	colour = pick("red","purple","jade","black", "pink", "blue")
	name = "[colour] lipstick"


/obj/item/weapon/reagent_containers/lipstick/attack_self(mob/user)
	user << "<span class='notice'>You twist \the [src] [open ? "closed" : "open"].</span>"
	open = !open
	if(open)
		icon_state = "[initial(icon_state)]_[colour]"
	else
		icon_state = initial(icon_state)

/obj/item/weapon/reagent_containers/lipstick/attack(mob/M, mob/user)
	if(!open)	return

	if(!istype(M, /mob))	return

	if(ishuman(M))
		var/mob/living/carbon/human/H = M
		if(H.lip_style)	//if they already have lipstick on
			user << "<span class='notice'>You need to wipe off the old lipstick first!</span>"
			return
		if(H == user)
			user.visible_message("<span class='notice'>[user] does their lips with \the [src].</span>", \
								 "<span class='notice'>You take a moment to apply \the [src]. Perfect!</span>")
			for(var/obj/item/weapon/reagent_containers/lips/L in H)
				src.reagents.trans_to(L, 30)
			H.lip_style = colour
			H.update_body()
		else
			user.visible_message("<span class='warning'>[user] begins to do [H]'s lips with \the [src].</span>", \
								 "<span class='notice'>You begin to apply \the [src].</span>")
			if(do_after(user, 20) && do_after(H, 20, 5, 0))	//user needs to keep their active hand, H does not.
				user.visible_message("<span class='notice'>[user] does [H]'s lips with \the [src].</span>", \
									 "<span class='notice'>You apply \the [src].</span>")
				for(var/obj/item/weapon/reagent_containers/lips/L in H)
					src.reagents.trans_to(L, 30)
				H.lip_style = colour
				H.update_body()
	else
		user << "<span class='notice'>Where are the lips on that?</span>"

/obj/item/weapon/reagent_containers/lipstick/death/New()
	..()
	reagents.add_reagent("cyanide", 30)

//you can wipe off lipstick with paper!
/obj/item/weapon/paper/attack(mob/M, mob/user)
	if(user.zone_sel.selecting == "mouth")
		if(!ismob(M))
			return

		if(ishuman(M))
			var/mob/living/carbon/human/H = M
			if(H == user)
				user << "<span class='notice'>You wipe off the lipstick with [src].</span>"
				H.lip_style = null
				H.update_body()
			else
				user.visible_message("<span class='warning'>[user] begins to wipe [H]'s lipstick off with \the [src].</span>", \
								 	 "<span class='notice'>You begin to wipe off [H]'s lipstick.</span>")
				if(do_after(user, 10) && do_after(H, 10, 5, 0))	//user needs to keep their active hand, H does not.
					user.visible_message("<span class='notice'>[user] wipes [H]'s lipstick off with \the [src].</span>", \
										 "<span class='notice'>You wipe off [H]'s lipstick.</span>")
					H.lip_style = null
					H.update_body()
	else
		..()


/obj/item/weapon/razor
	name = "electric razor"
	desc = "The latest and greatest power razor born from the science of shaving."
	icon = 'icons/obj/items.dmi'
	icon_state = "razor"
	flags = FPRINT | TABLEPASS| CONDUCT
	w_class = 1


/obj/item/weapon/razor/proc/shave(mob/living/carbon/human/H, location = "mouth")
	if(location == "mouth")
		H.f_style = "Shaved"
	else
		H.h_style = "Skinhead"

	H.update_hair()
	playsound(loc, 'sound/items/Welder2.ogg', 20, 1)


/obj/item/weapon/razor/attack(mob/M, mob/user)
	if(ishuman(M))
		var/mob/living/carbon/human/H = M

		var/location = user.zone_sel.selecting
		if(location == "mouth")
			if(!get_location_accessible(H, location))
				user << "<span class='notice'>The mask is in the way.</span>"
				return
			if(H.f_style == "Shaved")
				user << "<span class='notice'>Already clean-shaven.</span>"
				return

			if(H == user) //shaving yourself
				user.visible_message("<span class='notice'>[user] starts to shave their facial hair with [src].</span>", \
									 "<span class='notice'>You take a moment to shave your facial hair with [src].</span>")
				if(do_after(user, 50))
					user.visible_message("<span class='notice'>[user] shaves his facial hair clean with [src].</span>", \
										 "<span class='notice'>You finish shaving with [src]. Fast and clean!</span>")
					shave(H, location)
			else
				var/turf/H_loc = H.loc
				user.visible_message("<span class='warning'>[user] tries to shave [H]'s facial hair with [src].</span>", \
									 "<span class='notice'>You start shaving [H]'s facial hair.</span>")
				if(do_after(user, 50))
					if(H_loc == H.loc)
						user.visible_message("<span class='warning'>[user] shaves off [H]'s facial hair with [src].</span>", \
											 "<span class='notice'>You shave [H]'s facial hair clean off.</span>")
						shave(H, location)

		else if(location == "head")
			if(!get_location_accessible(H, location))
				user << "<span class='notice'>The headgear is in the way.</span>"
				return
			if(H.h_style == "Bald" || H.h_style == "Balding Hair" || H.h_style == "Skinhead")
				user << "<span class='notice'>There is not enough hair left to shave!</span>"
				return

			if(H == user) //shaving yourself
				user.visible_message("<span class='notice'>[user] starts to shave their head with [src].</span>", \
									 "<span class='notice'>You start to shave your head with [src].</span>")
				if(do_after(user, 50))
					user.visible_message("<span class='notice'>[user] shaves his head with [src].</span>", \
										 "<span class='notice'>You finish shaving with [src].</span>")
					shave(H, location)
			else
				var/turf/H_loc = H.loc
				user.visible_message("<span class='warning'>[user] tries to shave [H]'s head with [src]!</span>", \
									 "<span class='notice'>You start shaving [H]'s head.</span>")
				if(do_after(user, 50))
					if(H_loc == H.loc)
						user.visible_message("<span class='warning'>[user] shaves [H]'s head bald with [src]!</span>", \
											 "<span class='notice'>You shave [H]'s head bald.</span>")
						shave(H, location)
		else
			..()
	else
		..()